import LevelInitBase from "../LevelCommon/LevelInitBase";
import LevelControl3 from "../LevelControl/LevelControl3";
import RoomControl from "../LevelCommon/RoomControl";
import { utils } from "../../utils/CommonUtil";
import GamePropObj from "../Prefabs/InteractivObj/Common/GamePropObj";
import FocusParentObj from "../Prefabs/InteractivObj/Common/FocusParentObj";
import MoveObj from "../Prefabs/InteractivObj/Common/MoveObj";
import Clock from "../Prefabs/InteractivObj/Clock/Clock";
import HourPoint from "../Prefabs/InteractivObj/Clock/HourPoint";
import ClockBtn from "../Prefabs/InteractivObj/Clock/ClockBtn";
import Gate from "../Prefabs/InteractivObj/Gate";
import EnumData from "../../Enum/EnumData";

export default class LevelInit3 extends LevelInitBase {
    private room1: Laya.Sprite3D;
    private container: Laya.Sprite3D;

    public startInitDetail() {
        this.levelRoot.addComponent(LevelControl3);
        this.room1 = this.LevelObjs.getChildByName("room1") as Laya.Sprite3D;
        this.room1.addComponent(RoomControl);
        this.container = this.room1.getChildByName("Container") as Laya.Sprite3D;
        let walls = this.room1.getChildByName("walls") as Laya.Sprite3D;

        //#region Container
        let key_02_props = this.container.getChildByName("key_02_props") as Laya.Sprite3D;
        let GamePeopObj_key_02_props = utils.CommonUtils.CustomAddComponent(key_02_props, GamePropObj) as GamePropObj;
        GamePeopObj_key_02_props.gamePropId = 13;
        //#endregion

        //#region wall1
        let wall1 = walls.getChildByName("wall1") as Laya.Sprite3D;
        let Lamp_props = wall1.getChildByName("Lamp_props") as Laya.Sprite3D;
        let GamePeopObj_Lamp_props = utils.CommonUtils.CustomAddComponent(Lamp_props, GamePropObj) as GamePropObj;
        GamePeopObj_Lamp_props.gamePropId = 14;

        let jinianpin1 = wall1.getChildByName("jinianpin (1)") as Laya.Sprite3D;
        let GamePeopObj_jinianpin1 = utils.CommonUtils.CustomAddComponent(jinianpin1, GamePropObj) as GamePropObj;
        GamePeopObj_jinianpin1.gamePropId = 11;
        //#endregion

        //#region wall2
        let wall2 = walls.getChildByName("wall2") as Laya.Sprite3D;
        let Dresser = wall2.getChildByName("Dresser") as Laya.Sprite3D;
        utils.CommonUtils.CustomAddComponent(Dresser, FocusParentObj);

        let Drawer_01_props = Dresser.getChildByName("Drawer_01_props") as Laya.Sprite3D;
        let MoveObj_Drawer_01_props = utils.CommonUtils.CustomAddComponent(Drawer_01_props, MoveObj) as MoveObj;
        MoveObj_Drawer_01_props.targetPos = new Laya.Vector3(1.19, 0.902, 2.519);
        MoveObj_Drawer_01_props.VoiceName = "openChouTi";

        let Drawer_02_props = Dresser.getChildByName("Drawer_02_props") as Laya.Sprite3D;
        let MoveObj_Drawer_02_props = utils.CommonUtils.CustomAddComponent(Drawer_02_props, MoveObj) as MoveObj;
        MoveObj_Drawer_02_props.targetPos = new Laya.Vector3(1.189985, 0.2485342, 2.519);
        MoveObj_Drawer_02_props.VoiceName = "openChouTi";

        let spoon_props = Drawer_02_props.getChildByName("spoon_props") as Laya.Sprite3D;
        let GamePeopObj_spoon_props = utils.CommonUtils.CustomAddComponent(spoon_props, GamePropObj) as GamePropObj;
        GamePeopObj_spoon_props.gamePropId = 15;

        let Drawer_03_props = Dresser.getChildByName("Drawer_03_props") as Laya.Sprite3D;
        let MoveObj_Drawer_03_props = utils.CommonUtils.CustomAddComponent(Drawer_03_props, MoveObj) as MoveObj;
        MoveObj_Drawer_03_props.targetPos = new Laya.Vector3(1.189985, -0.379566, 2.519);
        MoveObj_Drawer_03_props.VoiceName = "openChouTi";

        let jinianpin = Drawer_03_props.getChildByName("jinianpin") as Laya.Sprite3D;
        let GamePeopObj_jinianpin = utils.CommonUtils.CustomAddComponent(jinianpin, GamePropObj) as GamePropObj;
        GamePeopObj_jinianpin.gamePropId = 11;


        let Drawer_05_props = Dresser.getChildByName("Drawer_05_props") as Laya.Sprite3D;
        let MoveObj_Drawer_05_props = utils.CommonUtils.CustomAddComponent(Drawer_05_props, MoveObj) as MoveObj;
        MoveObj_Drawer_05_props.targetPos = new Laya.Vector3(-1.268367, 0.2485344, 2.519);
        MoveObj_Drawer_05_props.VoiceName = "openChouTi";

        let lockFocus = Dresser.getChildByName("lockFocus") as Laya.Sprite3D;
        let FocusParentObj_lockFocus = utils.CommonUtils.CustomAddComponent(lockFocus, FocusParentObj) as FocusParentObj;

        let lock = lockFocus.getChildByName("lock") as Laya.Sprite3D;
        let Clock_lock = utils.CommonUtils.CustomAddComponent(lock, Clock) as Clock;
        Clock_lock.needPropId = 15;

        let hourPoint = lock.getChildByName("hourPoint") as Laya.Sprite3D;
        let HourPoint_hourPoint = utils.CommonUtils.CustomAddComponent(hourPoint, HourPoint) as HourPoint;

        let Cube = lock.getChildByName("Cube") as Laya.Sprite3D;
        let ClockBtn_Cube = utils.CommonUtils.CustomAddComponent(Cube, ClockBtn) as ClockBtn;

        //#endregion

        //#region wall3
        let wall3 = walls.getChildByName("wall3") as Laya.Sprite3D;

        let bell_01 = wall3.getChildByName("bell_01") as Laya.Sprite3D;
        utils.CommonUtils.CustomAddComponent(bell_01, FocusParentObj);

        let sofa = wall3.getChildByName("sofa") as Laya.Sprite3D;
        let FocusParentObj_sofa = utils.CommonUtils.CustomAddComponent(sofa, FocusParentObj) as FocusParentObj;
        FocusParentObj_sofa.isNeedCallToLevel = true;

        let sofa_props = sofa.getChildByName("sofa_props") as Laya.Sprite3D;
        let MoveObj_sofa_props = utils.CommonUtils.CustomAddComponent(sofa_props, MoveObj) as MoveObj;
        MoveObj_sofa_props.targetPos = new Laya.Vector3(2, 0, 0);
        MoveObj_sofa_props.VoiceName = "move";
        MoveObj_sofa_props.isNeedCallToLevel = true;

        let jinianpin2 = wall3.getChildByName("jinianpin") as Laya.Sprite3D;
        let GamePeopObj_jinianpin2 = utils.CommonUtils.CustomAddComponent(jinianpin2, GamePropObj) as GamePropObj;
        GamePeopObj_jinianpin2.gamePropId = 11;

        let door_02_props = wall3.getChildByName("door_02_props") as Laya.Sprite3D;
        let Gate_door_02_props = utils.CommonUtils.CustomAddComponent(door_02_props, Gate) as Gate;
        Gate_door_02_props.needPropId = 16;
        Gate_door_02_props.Angle=30;
        Gate_door_02_props.Axis = EnumData.Axis.Y;
        //#endregion
    }
}